Clone the global COVID-19 Data from the github repository:
git clone https://github.com/owid/covid-19-data.git
Load the required R Libraries:
library(ggplot2)
library(lubridate)
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
library(plotly)
## Warning: package 'plotly' was built under R version 4.1.1
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
Locate the Canadian Vaccination Data:
list.files("../covid-19-data-master/public/data/vaccinations/country_data/")[35]
## [1] "Canada.csv"
Read in the csv file:
(canadaVaccination <- read.csv("../covid-19-data-master/public/data/vaccinations/country_data/Canada.csv"))
Convert the data to a data frame:
canadaVaccination$date <- as.Date(canadaVaccination$date)
The date column will now be in a “date” format:
canadaVaccination
Plot the total vaccinations:
# plot air temp
ggplot(canadaVaccination, aes(date, total_vaccinations))+
geom_line()+
scale_x_date(date_breaks = "1 month", date_labels = "%b %Y")
plot_ly(canadaVaccination, x = ~date, y = ~total_vaccinations, type = 'scatter', mode = 'lines')